package com.barry.download.util;

import java.text.DecimalFormat;

public class Util
{
    public static final String NUMBER_FORMATE = "##";
    public static String formatNumber(double org)
    {
        DecimalFormat df = new DecimalFormat(NUMBER_FORMATE);
        return df.format(org);
    }


    public static String getPercentFormat(int one, int total)
    {
        String fenzi = formatNumber(((double) one / (double) total * 100));
        if ("NaN".equals(fenzi))
        {
            return "0%";
        }
        else
        {
            return formatNumber(((double) one / (double) total * 100)) + "%";
        }
    }

}
